<?php

namespace App\Admin\Controllers;

use App\Http\Controllers\Controller;
use App\Http\Requests;
use Encore\Admin\Layout\Content;
use Encore\Admin\Form;
use Encore\Admin\Grid;
use Encore\Admin\Show;
use App\Admin\Model\Flora;
use App\Admin\Model\System;
use Illuminate\Http\Request;
use DB;

class CodeAddController extends Controller
{

    public function excelCreate(Content $content)
    {
        return  $content
            ->header('名单导入')
            ->description('名单导入')
            ->body($this->excelform());
    }

    
    /**
     * Make a form builder.
     *
     * @return Form
     */
    protected function excelform()
    {
        $form = new Form(new System);
        $form->file('excel');

        $form->tools(function (Form\Tools $tools) {
            $tools->disableList();
            $tools->disableDelete();
            $tools->disableView();
        });

        $form->footer(function ($footer) {
            $footer->disableReset();
            $footer->disableViewCheck();
            $footer->disableCreatingCheck();
        });
        $form->setAction(admin_url('system/import'));
        return $form;
    }

    public function chunExcelCreate(Content $content)
    {
        return  $content
            ->header('春暖花开-名单导入')
            ->description('名单导入')
            ->body($this->chunExcelForm());
    }


    /**
     * Make a form builder.
     *
     * @return Form
     */
    protected function chunExcelForm()
    {
        $form = new Form(new System);
        $form->file('excel');

        $form->tools(function (Form\Tools $tools) {
            $tools->disableList();
            $tools->disableDelete();
            $tools->disableView();
        });

        $form->footer(function ($footer) {
            $footer->disableReset();
            $footer->disableViewCheck();
            $footer->disableCreatingCheck();
        });
        $form->setAction(admin_url('system/chun-import'));
        return $form;
    }

    public function xinExcelCreate(Content $content)
    {
        return  $content
            ->header('薪有所属-名单导入')
            ->description('名单导入')
            ->body($this->xinExcelForm());
    }


    /**
     * Make a form builder.
     *
     * @return Form
     */
    protected function xinExcelForm()
    {
        $form = new Form(new System);
        $form->file('excel');

        $form->tools(function (Form\Tools $tools) {
            $tools->disableList();
            $tools->disableDelete();
            $tools->disableView();
        });

        $form->footer(function ($footer) {
            $footer->disableReset();
            $footer->disableViewCheck();
            $footer->disableCreatingCheck();
        });
        $form->setAction(admin_url('system/xin-import'));
        return $form;
    }

    public function zhenExcelCreate(Content $content)
    {
        return  $content
            ->header('甄选新意-名单导入')
            ->description('名单导入')
            ->body($this->zhenExcelForm());
    }


    /**
     * Make a form builder.
     *
     * @return Form
     */
    protected function zhenExcelForm()
    {
        $form = new Form(new System);
        $form->file('excel');

        $form->tools(function (Form\Tools $tools) {
            $tools->disableList();
            $tools->disableDelete();
            $tools->disableView();
        });

        $form->footer(function ($footer) {
            $footer->disableReset();
            $footer->disableViewCheck();
            $footer->disableCreatingCheck();
        });
        $form->setAction(admin_url('system/zhen-import'));
        return $form;
    }
}
